import React, { Component } from 'react';
import { ListView } from 'antd-mobile';
import {Axios} from './common/common';
import './stylesheets/main.css';
// import logo from './logo.svg';
// import Mock from 'mockjs';

class App extends Component {
  constructor(props) {
     super(props);
     this.state = {
         movieQuery: []
     }
  }
  getMovieQuery =()=> {
      let _this = this;
      Axios('get','/query',{},function (res) {
          console.log('res=',res)
          let queryData = res.list;
          let listItems = [];
          queryData.map((item) =>{
              listItems.push({
                  chineseName: item.chineseName,
                  englishName: item.englishName,
                  portrait: item.portrait,  //头像
                  query: item.query, //简介
                  still: item.still, //剧照
                  runningTime: item.runningTime, //片长
                  grade: item.grade , //评分
              })

          })
          console.log('queryData=',queryData)
          _this.setState({
              movieQuery: queryData
          })
          // return (
          //     <li>{queryData}</li>
          // )
          // console.log('movieQuery=',_this.state.movieQuery)
      },function (err) {
          console.log(err);
      })
  }
  componentDidMount() {
      this.getMovieQuery();
      // console.log(<ListView/>)
  }
  componentWillUnmount() {

  }
  render() {
    return (
      <ListView
          // ref={el => this.lv = el}
          // dataSource={this.state.movieQuery}
          // renderHeader={() => <span>header</span>}
          // pageSize={4}
          // onScroll={() => { console.log('scroll'); }}
          // scrollRenderAheadDistance={500}
          // // onEndReached={this.onEndReached}
          // onEndReachedThreshold={10}
      />
    );
  }

}

export default App;



